package server;

import java.io.Serializable;

public class Proposal implements Serializable {

  private static final long serialVersionUID = -6179448409515060639L;
  private int n;
  private int proposerId;
  private boolean lock;
  private int numLock;
  private String lease_client;

  public Proposal() {
    n = 0;
    proposerId = 0;
    lock = false;
    numLock = -1;
    lease_client = "";
  }

  public Proposal(int proposal_n, int the_proposerId, boolean the_lock,
      int the_numLock, String the_client) {
    n = proposal_n;
    proposerId = the_proposerId;
    lock = the_lock;
    numLock = the_numLock;
    lease_client = the_client;
  }

  public int getNumber() {
    return n;
  }

  public int getProposerId() {
    return proposerId;
  }

  public void setProposerId(int proposerId) {
    this.proposerId = proposerId;
  }

  public boolean getLock() {
    return lock;
  }

  public int getNumLock() {
    return numLock;
  }

  /**
   * @param n
   *          the n to set
   */
  public void setN(int n) {
    this.n = n;
  }
  
  public String getClient() {
    return lease_client;
  }

  public String toString() {
    return "Proposal [proposer id: " + proposerId + ", proposal number: " + n
        + ", locked: " + lock + ", lock number: " + numLock + ", client: "
        + lease_client + "]";
  }

  public String keyString() {
    return "" + lock + numLock;
  }
}
